using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace LMSData
{
	/// <summary>
	/// Strongly-typed collection for the Course class.
	/// </summary>
	[Serializable]
	public partial class CourseCollection : ActiveList<Course, CourseCollection> 
	{	   
		public CourseCollection() {}

	}

	/// <summary>
	/// This is an ActiveRecord class which wraps the Course table.
	/// </summary>
	[Serializable]
	public partial class Course : ActiveRecord<Course>
	{
		#region .ctors and Default Settings
		
		public Course()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}

		
		private void InitSetDefaults() { SetDefaults(); }

		
		public Course(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}

		public Course(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}

		 
		public Course(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}

		
		protected static void SetSQLProps() { GetTableSchema(); }

		
		#endregion
		
		#region Schema and Query Accessor
		public static Query CreateQuery() { return new Query(Schema); }

		
		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}

		}

		
		private static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("Course", TableType.Table, DataService.GetInstance("LMS"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarCourseID = new TableSchema.TableColumn(schema);
				colvarCourseID.ColumnName = "CourseID";
				colvarCourseID.DataType = DbType.Int32;
				colvarCourseID.MaxLength = 0;
				colvarCourseID.AutoIncrement = true;
				colvarCourseID.IsNullable = false;
				colvarCourseID.IsPrimaryKey = true;
				colvarCourseID.IsForeignKey = false;
				colvarCourseID.IsReadOnly = false;
				colvarCourseID.DefaultSetting = @"";
				colvarCourseID.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCourseID);
				
				TableSchema.TableColumn colvarCourseName = new TableSchema.TableColumn(schema);
				colvarCourseName.ColumnName = "CourseName";
				colvarCourseName.DataType = DbType.String;
				colvarCourseName.MaxLength = 255;
				colvarCourseName.AutoIncrement = false;
				colvarCourseName.IsNullable = true;
				colvarCourseName.IsPrimaryKey = false;
				colvarCourseName.IsForeignKey = false;
				colvarCourseName.IsReadOnly = false;
				colvarCourseName.DefaultSetting = @"";
				colvarCourseName.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCourseName);
				
				TableSchema.TableColumn colvarDescription = new TableSchema.TableColumn(schema);
				colvarDescription.ColumnName = "Description";
				colvarDescription.DataType = DbType.String;
				colvarDescription.MaxLength = 4000;
				colvarDescription.AutoIncrement = false;
				colvarDescription.IsNullable = true;
				colvarDescription.IsPrimaryKey = false;
				colvarDescription.IsForeignKey = false;
				colvarDescription.IsReadOnly = false;
				colvarDescription.DefaultSetting = @"";
				colvarDescription.ForeignKeyTableName = "";
				schema.Columns.Add(colvarDescription);
				
				TableSchema.TableColumn colvarLanguage = new TableSchema.TableColumn(schema);
				colvarLanguage.ColumnName = "Language";
				colvarLanguage.DataType = DbType.String;
				colvarLanguage.MaxLength = 255;
				colvarLanguage.AutoIncrement = false;
				colvarLanguage.IsNullable = true;
				colvarLanguage.IsPrimaryKey = false;
				colvarLanguage.IsForeignKey = false;
				colvarLanguage.IsReadOnly = false;
				colvarLanguage.DefaultSetting = @"";
				colvarLanguage.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLanguage);
				
				TableSchema.TableColumn colvarKeywords = new TableSchema.TableColumn(schema);
				colvarKeywords.ColumnName = "Keywords";
				colvarKeywords.DataType = DbType.String;
				colvarKeywords.MaxLength = 4000;
				colvarKeywords.AutoIncrement = false;
				colvarKeywords.IsNullable = true;
				colvarKeywords.IsPrimaryKey = false;
				colvarKeywords.IsForeignKey = false;
				colvarKeywords.IsReadOnly = false;
				colvarKeywords.DefaultSetting = @"";
				colvarKeywords.ForeignKeyTableName = "";
				schema.Columns.Add(colvarKeywords);
				
				TableSchema.TableColumn colvarCoverage = new TableSchema.TableColumn(schema);
				colvarCoverage.ColumnName = "Coverage";
				colvarCoverage.DataType = DbType.String;
				colvarCoverage.MaxLength = 4000;
				colvarCoverage.AutoIncrement = false;
				colvarCoverage.IsNullable = true;
				colvarCoverage.IsPrimaryKey = false;
				colvarCoverage.IsForeignKey = false;
				colvarCoverage.IsReadOnly = false;
				colvarCoverage.DefaultSetting = @"";
				colvarCoverage.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCoverage);
				
				TableSchema.TableColumn colvarIsbn = new TableSchema.TableColumn(schema);
				colvarIsbn.ColumnName = "ISBN";
				colvarIsbn.DataType = DbType.String;
				colvarIsbn.MaxLength = 255;
				colvarIsbn.AutoIncrement = false;
				colvarIsbn.IsNullable = true;
				colvarIsbn.IsPrimaryKey = false;
				colvarIsbn.IsForeignKey = false;
				colvarIsbn.IsReadOnly = false;
				colvarIsbn.DefaultSetting = @"";
				colvarIsbn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarIsbn);
				
				TableSchema.TableColumn colvarLifeCycleDate = new TableSchema.TableColumn(schema);
				colvarLifeCycleDate.ColumnName = "LifeCycleDate";
				colvarLifeCycleDate.DataType = DbType.DateTime;
				colvarLifeCycleDate.MaxLength = 0;
				colvarLifeCycleDate.AutoIncrement = false;
				colvarLifeCycleDate.IsNullable = true;
				colvarLifeCycleDate.IsPrimaryKey = false;
				colvarLifeCycleDate.IsForeignKey = false;
				colvarLifeCycleDate.IsReadOnly = false;
				colvarLifeCycleDate.DefaultSetting = @"";
				colvarLifeCycleDate.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLifeCycleDate);
				
				TableSchema.TableColumn colvarNotes = new TableSchema.TableColumn(schema);
				colvarNotes.ColumnName = "Notes";
				colvarNotes.DataType = DbType.String;
				colvarNotes.MaxLength = 4000;
				colvarNotes.AutoIncrement = false;
				colvarNotes.IsNullable = true;
				colvarNotes.IsPrimaryKey = false;
				colvarNotes.IsForeignKey = false;
				colvarNotes.IsReadOnly = false;
				colvarNotes.DefaultSetting = @"";
				colvarNotes.ForeignKeyTableName = "";
				schema.Columns.Add(colvarNotes);
				
				TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
				colvarCreatedOn.ColumnName = "CreatedOn";
				colvarCreatedOn.DataType = DbType.DateTime;
				colvarCreatedOn.MaxLength = 0;
				colvarCreatedOn.AutoIncrement = false;
				colvarCreatedOn.IsNullable = true;
				colvarCreatedOn.IsPrimaryKey = false;
				colvarCreatedOn.IsForeignKey = false;
				colvarCreatedOn.IsReadOnly = false;
				colvarCreatedOn.DefaultSetting = @"";
				colvarCreatedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedOn);
				
				TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
				colvarCreatedBy.ColumnName = "CreatedBy";
				colvarCreatedBy.DataType = DbType.String;
				colvarCreatedBy.MaxLength = 50;
				colvarCreatedBy.AutoIncrement = false;
				colvarCreatedBy.IsNullable = true;
				colvarCreatedBy.IsPrimaryKey = false;
				colvarCreatedBy.IsForeignKey = false;
				colvarCreatedBy.IsReadOnly = false;
				colvarCreatedBy.DefaultSetting = @"";
				colvarCreatedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedBy);
				
				TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
				colvarModifiedOn.ColumnName = "ModifiedOn";
				colvarModifiedOn.DataType = DbType.DateTime;
				colvarModifiedOn.MaxLength = 0;
				colvarModifiedOn.AutoIncrement = false;
				colvarModifiedOn.IsNullable = true;
				colvarModifiedOn.IsPrimaryKey = false;
				colvarModifiedOn.IsForeignKey = false;
				colvarModifiedOn.IsReadOnly = false;
				colvarModifiedOn.DefaultSetting = @"";
				colvarModifiedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedOn);
				
				TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
				colvarModifiedBy.ColumnName = "ModifiedBy";
				colvarModifiedBy.DataType = DbType.String;
				colvarModifiedBy.MaxLength = 50;
				colvarModifiedBy.AutoIncrement = false;
				colvarModifiedBy.IsNullable = true;
				colvarModifiedBy.IsPrimaryKey = false;
				colvarModifiedBy.IsForeignKey = false;
				colvarModifiedBy.IsReadOnly = false;
				colvarModifiedBy.DefaultSetting = @"";
				colvarModifiedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedBy);
				
				TableSchema.TableColumn colvarIsDeleted = new TableSchema.TableColumn(schema);
				colvarIsDeleted.ColumnName = "IsDeleted";
				colvarIsDeleted.DataType = DbType.Boolean;
				colvarIsDeleted.MaxLength = 0;
				colvarIsDeleted.AutoIncrement = false;
				colvarIsDeleted.IsNullable = false;
				colvarIsDeleted.IsPrimaryKey = false;
				colvarIsDeleted.IsForeignKey = false;
				colvarIsDeleted.IsReadOnly = false;
				
						colvarIsDeleted.DefaultSetting = @"((0))";
				colvarIsDeleted.ForeignKeyTableName = "";
				schema.Columns.Add(colvarIsDeleted);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["LMS"].AddSchema("Course",schema);
			}

		}

		#endregion
		
		#region Props
		
		  
		[XmlAttribute("CourseID")]
		public int CourseID 
		{
			get { return GetColumnValue<int>("CourseID"); }

			set { SetColumnValue("CourseID", value); }

		}

		  
		[XmlAttribute("CourseName")]
		public string CourseName 
		{
			get { return GetColumnValue<string>("CourseName"); }

			set { SetColumnValue("CourseName", value); }

		}

		  
		[XmlAttribute("Description")]
		public string Description 
		{
			get { return GetColumnValue<string>("Description"); }

			set { SetColumnValue("Description", value); }

		}

		  
		[XmlAttribute("Language")]
		public string Language 
		{
			get { return GetColumnValue<string>("Language"); }

			set { SetColumnValue("Language", value); }

		}

		  
		[XmlAttribute("Keywords")]
		public string Keywords 
		{
			get { return GetColumnValue<string>("Keywords"); }

			set { SetColumnValue("Keywords", value); }

		}

		  
		[XmlAttribute("Coverage")]
		public string Coverage 
		{
			get { return GetColumnValue<string>("Coverage"); }

			set { SetColumnValue("Coverage", value); }

		}

		  
		[XmlAttribute("Isbn")]
		public string Isbn 
		{
			get { return GetColumnValue<string>("ISBN"); }

			set { SetColumnValue("ISBN", value); }

		}

		  
		[XmlAttribute("LifeCycleDate")]
		public DateTime? LifeCycleDate 
		{
			get { return GetColumnValue<DateTime?>("LifeCycleDate"); }

			set { SetColumnValue("LifeCycleDate", value); }

		}

		  
		[XmlAttribute("Notes")]
		public string Notes 
		{
			get { return GetColumnValue<string>("Notes"); }

			set { SetColumnValue("Notes", value); }

		}

		  
		[XmlAttribute("CreatedOn")]
		public DateTime? CreatedOn 
		{
			get { return GetColumnValue<DateTime?>("CreatedOn"); }

			set { SetColumnValue("CreatedOn", value); }

		}

		  
		[XmlAttribute("CreatedBy")]
		public string CreatedBy 
		{
			get { return GetColumnValue<string>("CreatedBy"); }

			set { SetColumnValue("CreatedBy", value); }

		}

		  
		[XmlAttribute("ModifiedOn")]
		public DateTime? ModifiedOn 
		{
			get { return GetColumnValue<DateTime?>("ModifiedOn"); }

			set { SetColumnValue("ModifiedOn", value); }

		}

		  
		[XmlAttribute("ModifiedBy")]
		public string ModifiedBy 
		{
			get { return GetColumnValue<string>("ModifiedBy"); }

			set { SetColumnValue("ModifiedBy", value); }

		}

		  
		[XmlAttribute("IsDeleted")]
		public bool IsDeleted 
		{
			get { return GetColumnValue<bool>("IsDeleted"); }

			set { SetColumnValue("IsDeleted", value); }

		}

		
		#endregion
		
		
		#region PrimaryKey Methods
		
		public LMSData.UserAssessmentCollection UserAssessmentRecords()
		{
			return new LMSData.UserAssessmentCollection().Where(UserAssessment.Columns.CourseID, CourseID).Load();
		}

		public LMSData.UserCourseMapCollection UserCourseMapRecords()
		{
			return new LMSData.UserCourseMapCollection().Where(UserCourseMap.Columns.CourseID, CourseID).Load();
		}

		public LMSData.AuditLaunchCollection AuditLaunchRecords()
		{
			return new LMSData.AuditLaunchCollection().Where(AuditLaunch.Columns.CourseID, CourseID).Load();
		}

		public LMSData.TrackingCollection TrackingRecords()
		{
			return new LMSData.TrackingCollection().Where(Tracking.Columns.CourseID, CourseID).Load();
		}

		public LMSData.AssessmentCollection AssessmentRecords()
		{
			return new LMSData.AssessmentCollection().Where(Assessment.Columns.CourseID, CourseID).Load();
		}

		public LMSData.CourseGroupMapCollection CourseGroupMapRecords()
		{
			return new LMSData.CourseGroupMapCollection().Where(CourseGroupMap.Columns.CourseID, CourseID).Load();
		}

		#endregion
		
			
		
		//no foreign key tables defined (0)
		
		
		
		#region Many To Many Helpers
		
		 
		public LMSData.GroupCollection GetGroupCollection() { return Course.GetGroupCollection(this.CourseID); }

		public static LMSData.GroupCollection GetGroupCollection(int varCourseID)
		{
			SubSonic.QueryCommand cmd = new SubSonic.QueryCommand(
				"SELECT * FROM Group INNER JOIN CourseGroupMap ON "+
				"Group.GroupID=CourseGroupMap.GroupID WHERE CourseGroupMap.CourseID=@CourseID", Course.Schema.Provider.Name);
			
			cmd.AddParameter("@CourseID", varCourseID, DbType.Int32);
			IDataReader rdr = SubSonic.DataService.GetReader(cmd);
			GroupCollection coll = new GroupCollection();
			coll.LoadAndCloseReader(rdr);
			return coll;
		}

		
		public static void SaveGroupMap(int varCourseID, GroupCollection items)
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			QueryCommand cmdDel = new QueryCommand("DELETE FROM CourseGroupMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (Group item in items)
			{
				CourseGroupMap varCourseGroupMap = new CourseGroupMap();
				varCourseGroupMap.SetColumnValue("CourseID", varCourseID);
				varCourseGroupMap.SetColumnValue("GroupID", item.GetPrimaryKeyValue());
				varCourseGroupMap.Save();
			}

		}

		public static void SaveGroupMap(int varCourseID, System.Web.UI.WebControls.ListItemCollection itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM CourseGroupMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (System.Web.UI.WebControls.ListItem l in itemList) 
			{
				if (l.Selected) 
				{
					CourseGroupMap varCourseGroupMap = new CourseGroupMap();
					varCourseGroupMap.SetColumnValue("CourseID", varCourseID);
					varCourseGroupMap.SetColumnValue("GroupID", l.Value);
					varCourseGroupMap.Save();
				}

			}

		}

		public static void SaveGroupMap(int varCourseID , int[] itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM CourseGroupMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (int item in itemList) 
			{
				CourseGroupMap varCourseGroupMap = new CourseGroupMap();
				varCourseGroupMap.SetColumnValue("CourseID", varCourseID);
				varCourseGroupMap.SetColumnValue("GroupID", item);
				varCourseGroupMap.Save();
			}

		}

		
		public static void DeleteGroupMap(int varCourseID) 
		{
			QueryCommand cmdDel = new QueryCommand("DELETE FROM CourseGroupMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			DataService.ExecuteQuery(cmdDel);
		}

		
		 
		public LMSData.UserCollection GetUserCollection() { return Course.GetUserCollection(this.CourseID); }

		public static LMSData.UserCollection GetUserCollection(int varCourseID)
		{
			SubSonic.QueryCommand cmd = new SubSonic.QueryCommand(
				"SELECT * FROM User INNER JOIN UserCourseMap ON "+
				"User.UserID=UserCourseMap.UserID WHERE UserCourseMap.CourseID=@CourseID", Course.Schema.Provider.Name);
			
			cmd.AddParameter("@CourseID", varCourseID, DbType.Int32);
			IDataReader rdr = SubSonic.DataService.GetReader(cmd);
			UserCollection coll = new UserCollection();
			coll.LoadAndCloseReader(rdr);
			return coll;
		}

		
		public static void SaveUserMap(int varCourseID, UserCollection items)
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			QueryCommand cmdDel = new QueryCommand("DELETE FROM UserCourseMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (User item in items)
			{
				UserCourseMap varUserCourseMap = new UserCourseMap();
				varUserCourseMap.SetColumnValue("CourseID", varCourseID);
				varUserCourseMap.SetColumnValue("UserID", item.GetPrimaryKeyValue());
				varUserCourseMap.Save();
			}

		}

		public static void SaveUserMap(int varCourseID, System.Web.UI.WebControls.ListItemCollection itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM UserCourseMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (System.Web.UI.WebControls.ListItem l in itemList) 
			{
				if (l.Selected) 
				{
					UserCourseMap varUserCourseMap = new UserCourseMap();
					varUserCourseMap.SetColumnValue("CourseID", varCourseID);
					varUserCourseMap.SetColumnValue("UserID", l.Value);
					varUserCourseMap.Save();
				}

			}

		}

		public static void SaveUserMap(int varCourseID , int[] itemList) 
		{
			QueryCommandCollection coll = new SubSonic.QueryCommandCollection();
			//delete out the existing
			 QueryCommand cmdDel = new QueryCommand("DELETE FROM UserCourseMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			coll.Add(cmdDel);
			DataService.ExecuteTransaction(coll);
			foreach (int item in itemList) 
			{
				UserCourseMap varUserCourseMap = new UserCourseMap();
				varUserCourseMap.SetColumnValue("CourseID", varCourseID);
				varUserCourseMap.SetColumnValue("UserID", item);
				varUserCourseMap.Save();
			}

		}

		
		public static void DeleteUserMap(int varCourseID) 
		{
			QueryCommand cmdDel = new QueryCommand("DELETE FROM UserCourseMap WHERE CourseID=@CourseID", Course.Schema.Provider.Name);
			cmdDel.AddParameter("@CourseID", varCourseID);
			DataService.ExecuteQuery(cmdDel);
		}

		
		#endregion
		
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(string varCourseName,string varDescription,string varLanguage,string varKeywords,string varCoverage,string varIsbn,DateTime? varLifeCycleDate,string varNotes,DateTime? varCreatedOn,string varCreatedBy,DateTime? varModifiedOn,string varModifiedBy,bool varIsDeleted)
		{
			Course item = new Course();
			
			item.CourseName = varCourseName;
			
			item.Description = varDescription;
			
			item.Language = varLanguage;
			
			item.Keywords = varKeywords;
			
			item.Coverage = varCoverage;
			
			item.Isbn = varIsbn;
			
			item.LifeCycleDate = varLifeCycleDate;
			
			item.Notes = varNotes;
			
			item.CreatedOn = varCreatedOn;
			
			item.CreatedBy = varCreatedBy;
			
			item.ModifiedOn = varModifiedOn;
			
			item.ModifiedBy = varModifiedBy;
			
			item.IsDeleted = varIsDeleted;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}

		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(int varCourseID,string varCourseName,string varDescription,string varLanguage,string varKeywords,string varCoverage,string varIsbn,DateTime? varLifeCycleDate,string varNotes,DateTime? varCreatedOn,string varCreatedBy,DateTime? varModifiedOn,string varModifiedBy,bool varIsDeleted)
		{
			Course item = new Course();
			
				item.CourseID = varCourseID;
				
				item.CourseName = varCourseName;
				
				item.Description = varDescription;
				
				item.Language = varLanguage;
				
				item.Keywords = varKeywords;
				
				item.Coverage = varCoverage;
				
				item.Isbn = varIsbn;
				
				item.LifeCycleDate = varLifeCycleDate;
				
				item.Notes = varNotes;
				
				item.CreatedOn = varCreatedOn;
				
				item.CreatedBy = varCreatedBy;
				
				item.ModifiedOn = varModifiedOn;
				
				item.ModifiedBy = varModifiedBy;
				
				item.IsDeleted = varIsDeleted;
				
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}

		#endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string CourseID = @"CourseID";
			 public static string CourseName = @"CourseName";
			 public static string Description = @"Description";
			 public static string Language = @"Language";
			 public static string Keywords = @"Keywords";
			 public static string Coverage = @"Coverage";
			 public static string Isbn = @"ISBN";
			 public static string LifeCycleDate = @"LifeCycleDate";
			 public static string Notes = @"Notes";
			 public static string CreatedOn = @"CreatedOn";
			 public static string CreatedBy = @"CreatedBy";
			 public static string ModifiedOn = @"ModifiedOn";
			 public static string ModifiedBy = @"ModifiedBy";
			 public static string IsDeleted = @"IsDeleted";
						
		}

		#endregion
	}

}

